#!/bin/bash
# 工业机器人控制系统依赖安装脚本

set -e

echo "=============================================="
echo "安装工业机器人控制系统依赖"
echo "=============================================="

# 检查是否以root权限运行
if [ "$EUID" -ne 0 ]; then
    echo "请使用sudo运行此脚本"
    exit 1
fi

echo "更新软件包列表..."
apt update

echo "安装编译工具..."
apt install -y \
    build-essential \
    cmake \
    git \
    clang-format \
    clang-tidy

echo "安装项目依赖..."
apt install -y \
    libeigen3-dev \
    libmodbus-dev \
    libyaml-cpp-dev \
    libwebsockets-dev

echo "安装IgH EtherCAT Master..."
# 这里添加EtherCAT安装步骤

echo "=============================================="
echo "依赖安装完成！"
echo "下一步操作:"
echo "1. mkdir build && cd build"
echo "2. cmake .. && make -j\$(nproc)"
echo "3. sudo make install"
echo "=============================================="